package financesV20240619

// ListTransactionsResponse represents the response from the ListTransactions API
type ListTransactionsResponse struct {
	Payload    transactions `json:"payload,omitempty"`
	StatusCode int          `json:"statusCode"`
}

type transactions struct {
	NextToken    string        `json:"nextToken,omitempty"`
	Transactions []transaction `json:"transactions,omitempty"`
}

// Transaction represents a financial transaction
type transaction struct {
	SellingPartnerMetadata struct {
		SellingPartnerId string `json:"sellingPartnerId,omitempty"`
		AccountType      string `json:"accountType,omitempty"`
		MarketplaceId    string `json:"marketplaceId,omitempty"`
	} `json:"sellingPartnerMetadata,omitempty"`
	RelatedIdentifiers []relatedIdentifier `json:"relatedIdentifiers,omitempty"`
	TransactionType    string              `json:"transactionType,omitempty"`
	TransactionId      string              `json:"transactionId,omitempty"`
	TransactionStatus  string              `json:"transactionStatus,omitempty"`
	Description        string              `json:"description,omitempty"`
	PostedDate         string              `json:"postedDate,omitempty"`
	TotalAmount        currency            `json:"totalAmount,omitempty"`
	MarketplaceDetails struct {
		MarketplaceId   string `json:"marketplaceId,omitempty"`
		MarketplaceName string `json:"marketplaceName,omitempty"`
	} `json:"marketplaceDetails,omitempty"`
	Items []struct {
		Description        string                  `json:"description,omitempty"`
		RelatedIdentifiers []itemRelatedIdentifier `json:"relatedIdentifiers,omitempty"`
		TotalAmount        currency                `json:"totalAmount,omitempty"`
		Breakdowns         []breakdown             `json:"breakdowns,omitempty"`
		Contexts           []context               `json:"contexts,omitempty"`
	} `json:"items"`
	Contexts   []context   `json:"contexts,omitempty"`
	Breakdowns []breakdown `json:"breakdowns"`
}
type currency struct {
	CurrencyCode   string  `json:"currencyCode,omitempty"`
	CurrencyAmount float64 `json:"currencyAmount,omitempty"`
}

// RelatedIdentifier represents a related business identifier of the transaction
type relatedIdentifier struct {
	RelatedIdentifierName  string `json:"relatedIdentifierName,omitempty"`
	RelatedIdentifierValue string `json:"relatedIdentifierValue,omitempty"`
}

// Breakdown provides details regarding the money movement under the financial transaction
type breakdown struct {
	BreakdownType   string `json:"breakdownType,omitempty"`
	BreakdownAmount struct {
		CurrencyCode   string  `json:"currencyCode,omitempty"`
		CurrencyAmount float64 `json:"currencyAmount,omitempty"`
	} `json:"breakdownAmount,omitempty"`
	Breakdowns []breakdown `json:"breakdowns,omitempty"`
}

// Context represents additional information about the item
type context struct {
	ContextType        string `json:"contextType"`
	StoreName          string `json:"storeName,omitempty"`
	OrderType          string `json:"orderType,omitempty"`
	Channel            string `json:"channel,omitempty"`
	Asin               string `json:"asin,omitempty"`
	Sku                string `json:"sku,omitempty"`
	QuantityShipped    int    `json:"quantityShipped,omitempty"`
	FulfillmentNetwork string `json:"fulfillmentNetwork,omitempty"`
	PaymentType        string `json:"paymentType,omitempty"`
	PaymentMethod      string `json:"paymentMethod,omitempty"`
	PaymentReference   string `json:"paymentReference,omitempty"`
	PaymentDate        string `json:"paymentDate,omitempty"`
	DeferralReason     string `json:"deferralReason,omitempty"`
	MaturityDate       string `json:"maturityDate,omitempty"`
	DeferralStatus     string `json:"deferralStatus,omitempty"`
	StartTime          string `json:"startTime,omitempty"`
	EndTime            string `json:"endTime,omitempty"`
}

// ItemRelatedIdentifier represents a related business identifier of the item
type itemRelatedIdentifier struct {
	ItemRelatedIdentifierName  string `json:"itemRelatedIdentifierName,omitempty"`
	ItemRelatedIdentifierValue string `json:"itemRelatedIdentifierValue,omitempty"`
}
